package com.jht.engine.platsign;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.text.TextUtils;
import com.jxw.engine.platsign.MainActivity;

/* loaded from: classes.dex */
public class PlatSignatureWrapper {
    private static final String TAG = "PlatSignatureWrapper";
    private Context mContext;

    /* loaded from: classes.dex */
    public interface OnVerify {
        void onError(boolean z);
    }

    public PlatSignatureWrapper(Context context) {
        this.mContext = context;
    }

    public void start(OnVerify onVerify) {
        verify(onVerify);
    }

    public String getSeries() {
        return this.mContext.getSharedPreferences(MainActivity.PREFERENCE, 0).getString("series", null);
    }

    public String getCustomIsbn() {
        return this.mContext.getSharedPreferences(MainActivity.PREFERENCE, 0).getString(MainActivity.CUSTOMISBN, null);
    }

    public String getExtra() {
        return this.mContext.getSharedPreferences(MainActivity.PREFERENCE, 0).getString("registMac", null);
    }

    private void verify(final OnVerify onVerify) {
        if (onVerify == null) {
            return;
        }
        new Thread(new Runnable() { // from class: com.jht.engine.platsign.PlatSignatureWrapper.1
            @Override // java.lang.Runnable
            public void run() {
                if (TextUtils.isEmpty(PlatSignatureWrapper.this.getSeries())) {
                    onVerify.onError(false);
                } else {
                    onVerify.onError(true);
                }
            }
        }).start();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static void showDialog(final Context context, String str, String str2, String str3, final Runnable runnable) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setIcon(17301543);
        builder.setMessage(str2);
        builder.setTitle(str);
        builder.setPositiveButton(str3, new DialogInterface.OnClickListener() { // from class: com.jht.engine.platsign.PlatSignatureWrapper.2
            @Override // android.content.DialogInterface.OnClickListener
            public void onClick(DialogInterface dialogInterface, int i) {
                try {
                    Intent intent = new Intent();
                    intent.setClassName("com.jxw.launcher", "com.jxw.engine.platsign.MainActivity");
                    context.startActivity(intent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                runnable.run();
            }
        });
        AlertDialog create = builder.create();
        create.setCancelable(false);
        create.setCanceledOnTouchOutside(false);
        create.show();
    }

    public static void showDialog(final Activity activity, final String str, final String str2, final String str3, final Runnable runnable) {
        activity.runOnUiThread(new Runnable() { // from class: com.jht.engine.platsign.PlatSignatureWrapper.3
            @Override // java.lang.Runnable
            public void run() {
                PlatSignatureWrapper.showDialog(activity, str, str2, str3, runnable);
            }
        });
    }
}
